{% load i18n fb_tags %}
<thead>
    <tr>
        <!-- SELECT -->
        {% if query.pop == "1" and results_var.select_total %}<th></th>{% endif %}
        {% if query.pop == "2" and results_var.select_total %}<th></th>{% endif %}
        {% if query.pop == "3" and results_var.select_total %}<th></th>{% endif %}
        <!-- FILETYPE -->
        {% ifequal query.o "filetype_checked" %}<th class="sorted {{ query.ot }}ending"><a href="{% query_string "" "o,ot,p" %}&amp;ot={% ifequal query.ot "desc" %}asc{% else %}desc{% endifequal %}&amp;o=filetype_checked">{% trans "Type" %}</a></th>{% endifequal %}
        {% ifnotequal query.o "filetype_checked" %}<th><a href="{% query_string "" "o,ot,p" %}&amp;ot=asc&amp;o=filetype_checked">{% trans "Type" %}</a></th>{% endifnotequal %}
        <!-- THUMB -->
        <th>{% trans "Thumbnail" %}</th>
        <!-- FILENAME / DIMENSIONS  -->
        {% ifequal query.o "filename_lower" %}<th class="filename sorted {{ query.ot }}ending"><a href="{% query_string "" "o,ot,p" %}&amp;ot={% ifequal query.ot "desc" %}asc{% else %}desc{% endifequal %}&amp;o=filename_lower">{% trans "Filename" %}</a></th>{% endifequal %}
        {% ifnotequal query.o "filename_lower" %}<th class="filename"><a href="{% query_string "" "o,ot,p" %}&amp;ot=asc&amp;o=filename_lower">{% trans "Filename" %}</a></th>{% endifnotequal %}
        <!-- FOLDER -->
        {% if q %}
            {% ifequal query.o 'folder' %}<th class="sorted {{ query.ot }}ending"><a href="{% query_string "" "o,ot,p" %}&amp;ot={% ifequal query.ot 'desc' %}asc{% else %}desc{% endifequal %}&amp;o=folder">{% trans 'Folder' %}</a></th>{% endifequal %}
            {% ifnotequal query.o 'folder' %}<th><a href="{% query_string "" "o,ot,p" %}&amp;ot=asc&amp;o=folder">{% trans 'Folder' %}</a></th>{% endifnotequal %}
        {% endif %}
        <!-- SIZE -->
        {% ifequal query.o "filesize" %}<th class="sorted {{ query.ot }}ending"><a href="{% query_string "" "o,ot,p" %}&amp;ot={% ifequal query.ot "desc" %}asc{% else %}desc{% endifequal %}&amp;o=filesize">{% trans "Size" %}</a></th>{% endifequal %}
        {% ifnotequal query.o "filesize" %}<th><a href="{% query_string "" "o,ot,p" %}&amp;ot=asc&amp;o=filesize">{% trans "Size" %}</a></th>{% endifnotequal %}
        <!-- DATE -->
        {% ifequal query.o "date" %}<th class="sorted {{ query.ot }}ending"><a href="{% query_string "" "o,ot,p" %}&amp;ot={% ifequal query.ot "desc" %}asc{% else %}desc{% endifequal %}&amp;o=date">{% trans "Date" %}</a></th>{% endifequal %}
        {% ifnotequal query.o "date" %}<th><a href="{% query_string "" "o,ot,p" %}&amp;ot=asc&amp;o=date">{% trans "Date" %}</a></th>{% endifnotequal %}
        <!-- ACTIONS -->
        <th>&nbsp;</th>
        <!-- DEBUG -->
        {% if settings_var.DEBUG %}<th>Debug</th>{% endif %}
    </tr>
</thead>